//
//  HJChatTextMsgModel.m
//  project
//
//  Created by hu on 2019/4/2.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJChatTextMsgModel.h"
#import "YFJourneyModel.h"


@implementation HJChatTextMsgModel

- (void)setContent:(NSString *)content {
    _content = content;
    CGSize size = [content boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 140, CGFLOAT_MAX) options: NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil].size;
    
    //内容
//    NSRange contentRange = NSMakeRange(0, content.length);
//    NSMutableAttributedString *contentAttributeString = [[NSMutableAttributedString alloc] initWithString:content];
//    NSMutableParagraphStyle *contentParagraphStyle = [[NSMutableParagraphStyle alloc] init];
////    contentParagraphStyle.lineSpacing = 10.f;
//    [contentAttributeString addAttribute:NSParagraphStyleAttributeName value:contentParagraphStyle range:contentRange];
//    [contentAttributeString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:13.f] range:contentRange];
//    [contentAttributeString addAttribute:NSKernAttributeName value:@(1) range:contentRange];
//    // 计算内容size
//    NSDictionary *contentAttribute = @{NSFontAttributeName:[UIFont systemFontOfSize:13.f],
//                                       NSParagraphStyleAttributeName:contentParagraphStyle,
//                                       NSKernAttributeName:@(1)};
//    CGSize contentSize = [content boundingRectWithSize:CGSizeMake(184, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:contentAttribute context:nil].size;
    
//    LKLog(@"%.2f, content=%@",size.height,content);
    if (size.height <=30) {
        size.height = 35;
    }
    self.cellHeight = size.height+10+30;
}


@end


@implementation HJSimpleModel

- (NSString *)description {
    return [self yy_modelDescription];
}

+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass {
    return @{ @"data": [HJSimpleDataModel class]};
}

@end

@implementation HJSimpleDataModel

+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass {
    return @{ @"trip": [YFTripModel class],@"user": [YFUserModel class],@"team": [HJTeamModel class],@"userB":[YFUserModel class]};
}

- (NSString *)description {
    return [self yy_modelDescription];
}
@end


@implementation HJTeamModel

+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
    return @{ @"simple_id":@"id"};
}

- (NSString *)description {
    return [self yy_modelDescription];
}

@end
